package 力扣;

import java.util.Arrays;

/**
 * @author yyq
 * @create 2022-06-02 14:33
 */
public class leetcode455 {
    public static void main(String[] args) {
        leetcode455 leetcode=new leetcode455();
        leetcode.findContentChildren(new int[]{1,2,3},new int[]{1,1});

    }
    public int findContentChildren(int[] g, int[] s) {
        int eated=0;
        int mini = 0;
        Arrays.sort(g);
        Arrays.sort(s);
        for(int i=0;i<s.length;i++){
            if(eated==g.length) break;
            for (int j =mini;j<g.length;j++){
                if(g[j]<=s[i]){
                    eated++;
                    mini=j+1;
                    break;
                }
            }

        }
        return eated;
    }
}
